package com.iflytek.hive.need2;


import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class Amount10WMapper extends Mapper<LongWritable, Text, Text, NullWritable> {
    private final Text keyOut = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // 将行文本数据切分
        String[] fields = value.toString().split(",");
        // 获取订单ID
        String orderId = fields[2];
        // 获取销售额
        String amount = fields[3];
        if (Double.valueOf(amount)  > 100000) {
            keyOut.set(orderId+","+amount);
            context.write(keyOut, NullWritable.get());
        }
    }

}
